package com.hutao.medical.common.util;

import java.lang.reflect.Field;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.Map;

import com.hutao.medical.pojo.vo.MedicalAjaxVo;

public class MapUtil {
	
	private static SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd");

    public static Map<String, Object> objectToMap(Object obj) throws Exception {    
        if(obj == null){    
            return null;    
        }   
  
        Map<String, Object> map = new HashMap<String, Object>();    
  
        Field[] declaredFields = obj.getClass().getDeclaredFields();    
        for (Field field : declaredFields) {    
            field.setAccessible(true);
            System.out.println(field.getGenericType());
            map.put(field.getName(), field.get(obj));  
        }    
  
        return map;  
    }
    
    public static Map<String, String> objToMap(Object obj) throws Exception {    
        if(obj == null){    
            return null;    
        }   
  
        Map<String, String> map = new HashMap<String, String>();    
  
        Field[] declaredFields = obj.getClass().getDeclaredFields();    
        for (Field field : declaredFields) {    
            field.setAccessible(true);
            
            System.out.println(field);
            map.put(field.getName(), (String) field.get(obj));  
        }    
  
        return map;  
    }
    
    
   
}
